<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <script type="text/javascript">
            function popup(pagina) {
                //alert('hola ' + pagina);                
                window.open(pagina,'1402953968202','width=700,height=500,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=300,top=10');
            }
        </script>
    </head>
    <body>

<script type="text/javascript">
            function popup(pagina) {
                //alert('hola ' + pagina);                
                window.open(pagina,'1402953968202','width=700,height=500,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=300,top=10');
            }
        </script>
        
<?php

include_once ('../includes/utilidades.php');
//include_once('../includes/config.php');
session_start();
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

$objeto = $_REQUEST['nombreObjeto'];
$valores = array();
foreach ($_REQUEST as $key => $value) {
    if ($key=="PHPSESSID") {
        continue;
    }
    if ($key != 'nombreObjeto') {
        $valores[$key] = $value;
    }
    
}

//print_r($valores);

$fin = false;



//if (sizeof($tablas['fkinfo'][$objeto]) > 0) {
//print "KK1";
//print_r($tablas);
//print "KK2";
if  (array_key_exists($objeto, $tablas['fkinfo'])){
    
    $next = $tablas['fkinfo'][$objeto]['fkTable'];
    //print_r($next);

    $lista = array();
    while (!$fin) {

        if (!isset($tablas['fkinfo'][$next]['fkTable'])) {
            $lista[] = $next;
            $fin = true;
        } else {
            $lista[] = $next;
            $next = $tablas['fkinfo'][$next]['fkTable'];
        }
    }

    //print_r($_SESSION);
    foreach (array_reverse($lista) as $key => $val) {
        if (array_key_exists('nombre', $_SESSION['estado'][$val][0])) {
            print "<h1>" . $val . " " . $_SESSION['estado'][$val][0]['nombre'] . "</h1>";
        }
        else {
            print "<h1>" .  $_SESSION['estado'][$val][0]['prueba'] . "</h1>";          
        }
    }
}


print "<html><body>";
//print_r($valores);
//HTMLFormTablaAdd($objeto, $_SESSION['estado'], $tablas);
HTMLFormTablaAction($objeto, $tablas[$objeto], 'doAddObjeto.php',$valores);
//print session_id();
//print $_SESSION['afterAddcompeticion']
?>

</body></html>